docs(website): align clipboard page with the @public copy API#159
Merged
Conversation
The grid clipboard page's onCopy example referenced functions that don't exist
(serializeAsTsv / serializeAsHtmlTable) and an arg shape that's wrong
(`{ ranges, snapshot }`). The real onCopy signature is
`(args: SerializeRangesArgs) => CopyPayload | null` where SerializeRangesArgs is
`{ ranges, visibleRows, columns, copyWithHeaders }`, and the return is a
CopyPayload (`{ text, html? }`) or null — never a bare string.
- Rewrite the onCopy example to use the real `serializeRangesAsTsv` and the
correct args shape (a working TSV→CSV override).
- Correct the documented return type (CopyPayload | null, not string).
- Add a "Building your own serializer" section documenting SerializeRangesArgs's
fields and `defaultCoerceForCopy` (both @public, previously undocumented).
- Document the `copyToClipboard` prop (also @public).
Closes the clipboard-docs-alignment follow-up from the PR 3 @public commitment.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Vercel preview readyPreview: https://pretable-dd5m810xq-cacheplane.vercel.app Updated automatically by the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The grid Clipboard docs page already exists, but its
onCopyexample was broken — it referenced functions that don't exist (serializeAsTsv/serializeAsHtmlTable) and the wrong argument shape ({ ranges, snapshot }). It also claimedonCopycould return a barestring, which the type doesn't allow.This aligns the page with the actual
@publiccopy API (the symbols PR 3 committed to as stable).The real API (verified in
packages/react/src/copy.ts+pretable-surface.tsx)Changes
onCopyexample → realserializeRangesAsTsv+ correctSerializeRangesArgsshape (a working TSV→CSV override).CopyPayload | null, not a barestring.SerializeRangesArgs's fields anddefaultCoerceForCopy(both@public, previously undocumented).copyToClipboardprop (also@public, previously undocumented).Gates
lib/docsenumerate/load/search-index +llms.txtbuild) — 21 passedprettier --checkclean#default-tsv-format) and cross-links verified to exist🤖 Generated with Claude Code